package com.haixiaoke.saas.lock.service;

import com.haixiaoke.saas.common.core.page.TableDataInfo;
import com.haixiaoke.saas.lock.domain.HouseLock;
import com.haixiaoke.saas.lock.domain.LockFace;
import com.haixiaoke.saas.lock.domain.LockPwd;
import com.haixiaoke.saas.workOrder.domain.WorkOrder;
import com.haixiaoke.saas.workOrder.domain.WorkOrderPwdRecord;

import java.util.Date;
import java.util.List;


/**
 * 房间锁信息Service接口
 *
 * @author qixi
 * @date 2024-07-25
 */
public interface IHouseLockService {
    /**
     * 查询房间锁信息
     *
     * @param lockId 房间锁信息主键
     * @return 房间锁信息
     */
    HouseLock selectHouseLockByLockId(Long lockId);

    /**
     * 查询房间锁信息列表
     *
     * @param houseLock 房间锁信息
     * @return 房间锁信息集合
     */
    List<HouseLock> selectHouseLockList(HouseLock houseLock);

    /**
     * 新增房间锁信息
     *
     * @param houseLock 房间锁信息
     * @return 结果
     */
    int insertHouseLock(HouseLock houseLock);

    /**
     * 修改房间锁信息
     *
     * @param houseLock 房间锁信息
     * @return 结果
     */
    int updateHouseLock(HouseLock houseLock);

    /**
     * 批量删除房间锁信息
     *
     * @param lockIds 需要删除的房间锁信息主键集合
     * @return 结果
     */
    int deleteHouseLockByLockIds(Long[] lockIds);

    /**
     * 删除房间锁信息信息
     *
     * @param lockId 房间锁信息主键
     * @return 结果
     */
    int deleteHouseLockByLockId(Long lockId);

    int createHouseLock(HouseLock houseLock);

    HouseLock selectHouseLockByMac(String mac, String tenantId);

    HouseLock selectHouseLockByLockName(String lockName, String tenantId);

    /**
     * 根据房间ID和锁状态查询房间锁信息
     *
     * @param houseId
     * @param lockState
     * @return
     */
    List<HouseLock> selectHouseLockByHouseIdAndLockState(String houseId, String lockState);

    int insertLockFace(LockFace lockFace);

    int removeLockFace(Long faceId);

    int insertLockPwd(LockPwd lockPwd);

    int removeLockPwd(Long pwdId);

    TableDataInfo outerOpenDoorRecord(Long lockId, String identification, Date startTime, Date endTime, Integer unlockType, Integer pageNum, Integer pageSize);

    int removeLock(Long lockId);

    List<LockPwd> selectPwdList(HouseLock houseLock);

    int insertFlatLockPwd(LockPwd lockPwd);

    /**
     * 根据房屋ID修改智能锁状态--变为正常状态
     *
     * @param houseId
     * @param houseLockList
     * @return
     */
    int updateHouseLockState(String houseId, List<HouseLock> houseLockList);

    /**
     * 删除人脸授权信息并把人脸信息禁用
     *
     * @param houseLock
     * @param lockFace
     * @return
     */
    int disableLockFaceAndFaceState(HouseLock houseLock, LockFace lockFace);

    /**
     * 根据房屋ID查询房间锁信息
     *
     * @param houseId
     * @return
     */
    List<HouseLock> selectHouseLockByHouseId(String houseId);

    /**
     * 授权人脸授权信息并把人脸信息启用
     *
     * @param mac
     * @param lockFace
     * @return
     */
    int authorizationLockFace(String mac, LockFace lockFace);

    /**
     * 根据房屋ID和用户类型删除锁密码和锁人脸信息
     *
     * @param houseId
     * @param userType
     */
    void removeLockPwdAndLockFace(String houseId, String userType);

    /**
     * 根据订单ID删除租客类型的锁密码和锁人脸信息
     *
     * @param orderId
     */
    void removeLockPwdAndLockFace(String orderId);

    int changeRoom(HouseLock houseLock);

    int updateLockStatus(HouseLock houseLock);

    void lockAutoFreezeTask();


    List<HouseLock> selectHouseLockListAndTenantState(HouseLock houseLock);

    int reAuthFace(LockFace lockFace);

    void updateHouseManager(String houseId, Long houseManagerId);

    void workOrderAuthPwd(WorkOrderPwdRecord workOrderPwdRecord);
}
